<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>学生管理--个人资料</title>
    <meta name="description" content="这是一个 index 页面">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="icon" type="image/png" href="assets/i/favicon.png">
    <link rel="apple-touch-icon-precomposed" href="assets/i/app-icon72x72@2x.png">
    <meta name="apple-mobile-web-app-title" content="Amaze UI" />
    <link rel="stylesheet" href="assets/css/amazeui.min.css" />
    <link rel="stylesheet" href="assets/css/amazeui.datatables.min.css" />
    <link rel="stylesheet" href="assets/css/bootstrap.min.css">
    <link rel="stylesheet" href="assets/css/app.css">
    <link rel="stylesheet" href="assets/css/gb_my.css">
    <link rel="stylesheet" href="assets/css/font-awesome.css">
    <link rel="stylesheet" href="assets/css/bootstrap-reset.css">
    <link rel="stylesheet" href="assets/css/easydropdown.css">
    <link rel="stylesheet" href="assets/css/bootstrap-fileinput.css">
    <link rel="stylesheet" href="assets/css/layer-animate.css">
</head>
<body data-type="chart">
<div class="am-g tpl-g">
    <!--头部-->
    <nav class="navbar navbar-default top-navbar">
        <div class="navbar-header">
            <a class="navbar-brand waves-effect waves-dark" href="javascript:;">
                <img src="assets/img/logo.png" alt="">
                <strong>轻课网考试系统</strong>
            </a>
            <div id="sideNav" href="">
                <i class="mulv QK QK-mulu"></i>
            </div>
        </div>
        <ul class="nav navbar-top-links navbar-right aaa">
            <li>
                <a id="down_" class="sign-out dropdown-button waves-effect waves-dark" href="javascript:;">
                    <span class="am-icon-sign-out"></span> 退出
                </a>
            </li>
            <li>
                <a class="dropdown-button waves-effect waves-dark" href="javascript:;"><b>欢迎你, <span class="userName"></span> </b></a>
            </li>
        </ul>
    </nav>
    <!--导航栏-->
    <nav class="navbar-default navbar-side">
        <div class="sidebar-collapse">
            <!--用户头像-->
            <div class="tpl-sidebar-user-panel">
                <div class="tpl-user-panel-slide-toggleable">
                    <div class="tpl-user-panel-profile-picture">
                        <img src="assets/img/user04.png" alt="">
                    </div>
                </div>
            </div>
            <dl class="list_dl">
                <dt class="list_dt">
                    <a href="index.html">
                        <span class="QK1 start_before"></span>
                        <p>学生平台</p>
                    </a>
                </dt>
                <dt class="list_dt">
                    <span class="QK1 topic_before"></span>
                    <p>我的考试</p>
                    <i class="QK1 list_dt_icon"></i>
                </dt>
                <dd class="list_dd">
                    <ul>
                        <li class="list_li">
                            <a href="student.html">我的试卷</a>
                        </li>
                        <li class="list_li">
                            <a href="examRecords.html">考试记录</a>
                        </li>
                    </ul>
                </dd>
                <dt class="list_dt">
                    <span class="QK1 paper_before"></span>
                    <p>自我检测</p>
                    <i class="QK1 list_dt_icon"></i>
                </dt>
                <dd class="list_dd">
                    <ul>
                        <li class="list_li">
                            <a href="testing.html">自我检测</a>
                        </li>
                        <li class="list_li">
                            <a href="error.html">检测结果</a>
                        </li>
                    </ul>
                </dd>
                <dt id="open" class="list_dt">
                    <span class="QK1 user_before"></span>
                    <p>个人管理</p>
                    <i class="QK1 list_dt_icon"></i>
                </dt>
                <dd class="list_dd" style="display: block">
                    <ul>
                        <li class="list_li" id="style_li_a">
                            <a href="personalData.html">个人资料</a>
                        </li>
                        <li class="list_li">
                            <a href="collection.html">题目收藏</a>
                        </li>
                    </ul>
                </dd>
                <dt class="list_dt">
                    <span class="QK1 chat_before"></span>
                    <p>聊天室</p>
                    <i class="QK1 list_dt_icon"></i>
                </dt>
                <dd class="list_dd">
                    <ul>
                        <li class="list_li">
                            <a href="chatroom.html">聊天室</a>
                        </li>
                    </ul>
                </dd>
            </dl>
        </div>
    </nav>
    <!-- 内容区域 -->
    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <section class="panel">
                    <header class="panel-heading">
                        <span class="label label-primary">个人信息</span>
                    </header>
                    <div class="panel-body">
                        <div class="form-horizontal add_form_style">
                            <div class="loading">
                                <span></span>
                                <span></span>
                                <span></span>
                                <span></span>
                                <span></span>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-1 col-sm-1 control-label">姓名</label>
                                <div class="col-lg-4 text_test">
                                    <input type="text" class="form-control userName" id="userName" placeholder="暂无" disabled>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-1 col-sm-1 control-label">性别</label>
                                <div class="col-lg-4 text_test">
                                    <input type="text" class="form-control"  name="sex" id="sex" disabled>
                                </div>
                            </div>
                            <!--<div class="form-group">-->
                                <!--<label class="col-lg-1 col-sm-1 control-label">密码</label>-->
                                <!--<div class="col-lg-4 text_test">-->
                                    <!--<input type="password" class="form-control userPassword">-->
                                <!--</div>-->
                            <!--</div>-->
                            <!--<div class="form-group">-->
                                <!--<label class="col-lg-1 col-sm-1 control-label">确认密码</label>-->
                                <!--<div class="col-lg-4 text_test">-->
                                    <!--<input type="password" class="form-control" name="confirmPassword" id="confirmPassword">-->
                                <!--</div>-->
                            <!--</div>-->
                            <!--<div class="form-group" id="uploadForm" enctype='multipart/form-data'>-->
                                <!--<label class="col-lg-1 col-sm-1 control-label">我的头像</label>-->
                                <!--<div class="col-lg-4 fileinput fileinput-new" data-provides="fileinput"  id="exampleInputUpload">-->
                                    <!--<div class="fileinput-new thumbnail">-->
                                        <!--<img id='picImg' src="assets/img/noImage.png" alt="" />-->
                                    <!--</div>-->
                                    <!--<div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 200px; max-height: 150px;"></div>-->
                                    <!--<div class="btn_all">-->
                                        <!--<span class="btn btn-primary btn-file">-->
                                            <!--<span class="fileinput-new">选择文件</span>-->
                                            <!--<span class="fileinput-exists">换一张</span>-->
                                            <!--<input type="file" name="pic1" id="picID" accept="image/gif,image/jpeg,image/x-png"/>-->
                                        <!--</span>-->
                                        <!--<a href="javascript:;" class="btn btn-warning fileinput-exists" data-dismiss="fileinput">移除</a>-->
                                    <!--</div>-->
                                <!--</div>-->
                            <!--</div>-->
                            <div class="form-group">
                                <label class="col-lg-1 col-sm-1 control-label">学历</label>
                                <div class="col-lg-4 text_test">
                                    <input type="text" class="form-control" name="Education" id="Education">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-1 col-sm-1 control-label">专业</label>
                                <div class="col-lg-4 text_test">
                                    <input type="text" class="form-control" name="major" id="major">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-1 col-sm-1 control-label">毕业院校</label>
                                <div class="col-lg-4 text_test">
                                    <input type="text" class="form-control" name="myState" id="myState">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-1 col-sm-1 control-label">身份证号</label>
                                <div class="col-lg-4 text_test">
                                    <input type="text" class="form-control" name="fullName" id="fullName" disabled>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-1 col-sm-1 control-label">联系电话</label>
                                <div class="col-lg-4 text_test">
                                    <input type="text" class="form-control" name="userPhone" id="userPhone">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-1 col-sm-1 control-label">紧急联系人</label>
                                <div class="col-lg-2 text_test">
                                    <input type="text" class="form-control" name="emergencyContact" id="emergencyContact" placeholder="For your life">
                                </div>
                                <label class="col-lg-1 col-sm-1 control-label">联系人电话</label>
                                <div class="col-lg-2 text_test">
                                    <input type="text" class="form-control" name="emergencyPhone" id="emergencyPhone" placeholder="For your life">
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-lg-1 col-sm-1">
                                    <button type="button" class="btn btn-block submit_button" id="Confirmation">确认修改</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </section>
            </div>
        </div>
    </div>
</div>
</body>
</html>
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/theme.js"></script>
<script src="assets/js/easydropdown.js"></script>
<script src="assets/js/html5sv.js"></script>
<script src="assets/js/bootstrap-fileinput.js"></script>
<script type="text/javascript" src="assets/js/jquery.cookie.js"></script>
<script src="assets/js/amazeui.min.js"></script>
<script src="assets/js/amazeui.datatables.min.js"></script>
<script src="assets/js/dataTables.responsive.min.js"></script>
<script src="assets/js/student.js"></script>
<script src="assets/js/method.js"></script>
<script>
    $('.loading').css('display' , 'block');
    $(document).ready(function () {
        var storage = window.localStorage;
        var user_id = storage["uid"];
        $.ajax({
            type:"get",
            url:api + "/student/selectStudentAndEmergency",
            data:{
                id:user_id
            },
            success:function(rep){
                $('.loading').css('display' , 'none');
                if (rep.message == "Success") {
                    var record = rep.data.record[0];
                    $('#userName').val(record.name);
                    if(record.gender == '1'){
                        $('#sex').val('男');
                    }else{
                        $('#sex').val('女');
                    }
                    $('#Education').val(record.education);
                    $('#major').val(record.major);
                    $('#myState').val(record.schoolName);
                    $('#fullName').val(record.idCard);
                    $('#userPhone').val(record.phone);
                    $('#emergencyContact').val(record.ec.name);
                    $('#emergencyPhone').val(record.ec.phone);
                }
            },
            error:function(rep){
                console.log("失败");
            }
        });
        $('#Confirmation').click(function () {
//            var modify_userName = $('#userName').val();
            var modify_userEducation = $('#Education').val();
            var modify_userMajor = $('#major').val();
            var modify_myState = $('#myState').val();
            var modify_userPhone = $('#userPhone').val();
            var modify_emergencyContact = $('#emergencyContact').val();
            var modify_emergencyPhone = $('#emergencyPhone').val();
            $.ajax({
                type:"post",
                url:api + "/student/updateStudentAndEmergency",
                data:{
                    para:'{"sid":'+ user_id +',"schoolName":"'+ modify_myState +'",' +
                    '"major":"'+ modify_userMajor +'","education":"'+ modify_userEducation +'","phone":"'+ modify_userPhone +'"}',
                    para2:'{"name":"'+ modify_emergencyContact +'","phone":"'+ modify_emergencyPhone +'","sid":1}'
                },
                success:function(rep){
                    if (rep.message == "Success") {
                        var obj={
                            type:"layerFadeIn",
                            close:"true",
                            content:"<div>修改成功",
                            btn:["","确定"]
                        };
                        method.msg_layer(obj);
                    }else{
                        var obj={
                            type:"showSweetAlert",
                            close:"true",
                            content:"<div>修改失败",
                            btn:["取消",""]
                        };
                        method.msg_layer(obj);
                        $('.layer-commit').remove();
                    }
                },
                error: function (result) {
                    var obj={
                        type:"showSweetAlert",
                        close:"true",
                        content:"<div>系统错误",
                        btn:["取消",""]
                    };
                    method.msg_layer(obj);
                    $('.layer-commit').remove();
                }
            });
        });
    });
</script>
<script>
    $(document).ready(function() {
        $(".list_dt").on("click", function() {
            $('.list_dd').stop();
            $(this).siblings("dt").removeAttr("id");
            if($(this).attr("id") == "open") {
                $(this).removeAttr("id").siblings("dd").slideUp();
            } else {
                $(this).attr("id", "open").next().slideDown().siblings("dd").slideUp();
            }
        });
    });
</script>
<script>
    $(document).ready(function() {
        $(".dropdown-button").dropdown();
        $("#sideNav").click(function() {
            if($(this).hasClass('closed')) {
                $('.navbar-side').animate({
                    left: '0px'
                });
                $(this).removeClass('closed');
                $('#page-wrapper').animate({
                    'margin-left': '260px'
                });
            } else {
                $(this).addClass('closed');
                $('.navbar-side').animate({
                    left: '-260px'
                });
                $('#page-wrapper').animate({
                    'margin-left': '0px'
                });
            }
        });
    });
    $(".dropdown-button").dropdown();
</script>